import { Tag } from '@douyinfe/semi-ui';
import { ColumnProps } from '@douyinfe/semi-ui/lib/es/table';
import dayjs from 'dayjs';
import { dictionaryTypes } from '../dictionary-helper';

const BaseColumns: ColumnProps[] = [
  {
    title: '字典类型编码',
    dataIndex: 'dictionaryType',
    render: (text) => {
      return <div className=' font-semibold'>{text}</div>;
    },
  },
  {
    title: '字典类型名称',
    dataIndex: 'dictionaryTypeName',
    render: (_, record) => {
      return (
        <div className='font-semibold'>
          {
            // @ts-ignore
            dictionaryTypes[record?.dictionaryType]?.text
          }
        </div>
      );
    },
  },
  {
    dataIndex: 'dictionaryKey',
    title: ' 字典值',
  },
  {
    dataIndex: 'dictionaryName',
    title: ' 字典名称',
  },
  {
    dataIndex: 'dictionaryValue',
    title: '字典属性',
  },
  {
    dataIndex: 'system',
    title: '状态',
    render: (cellContent) => {
      return (
        <Tag color={cellContent ? 'red' : 'green'}>
          {cellContent ? '关闭' : '开启'}
        </Tag>
      );
    },
  },
  {
    dataIndex: 'createDateTime',
    title: '创建时间',
    render: (cellContent) => {
      return (
        <span>
          {cellContent ? dayjs(cellContent).format('YYYY-MM-DD HH:mm:ss') : '-'}
        </span>
      );
    },
  },
];

export default BaseColumns;
